﻿using Lg.Core;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace SKS.Web.Filters
{
    public class OptionsCorsAttribute : ActionFilterAttribute, IAuthorizationFilter
    {
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            if (context.HttpContext.Request.Method.ToLower() == "options")
            {
                context.Result= new ContentResult { Content ="{\"code\":0,\"msg\":\"success\"}" };
            }
        }
    }
}
